require(['./config'],()=>{
    require(['jquery','jquerycookie'],()=>{
        class Zhuce{
            constructor(){
                this.register()
            }
            register(){ 
                $('.btn').click(function(){
                    //获取手机号
                    const phone = $('.phone').val()
                    //查找cookie里有没有匹配手机号
                    const account = $.cookie(phone)
                    //如果有的话显示已注册，没有的话进行注册
                    if(account){
                        $('.phone').val('!已注册，请直接登录')
                        $('.phone').css({
                            color:'red',
                            borderColor:'red'
                        })
                    }else{
                        window.location.href = "/html/zhuce2.html";
                        $.cookie('随便',phone,{expires:7,path:'/'});
                    }
                })
                this.proving()
            }
            proving(){
                $('.page .next').click(()=>{
                    let user = $.cookie('随便')
                    //获取验证码的值
                    const code = $('.code').val()
                    $.cookie(user,code,{expires:7,path:'/'});
                    window.location.href = "/html/zhuce3.html";
                })
                $('.return').click(()=>{
                    window.location.href = "/html/zhuce.html";
                })
                this.account()
            }
            account(){
                $('.con .user').html($.cookie('随便'))
                console.log($.cookie('随便'))
                $('.con .login').click(()=>{
                    window.location.href = "/index.html";
                })
            }
        }
        return new Zhuce()
    })
})